#include "QSocketClientManager.h"
#include "localServer.h"
QSocketClientManager g_qSocketClientManager;
bool QSocketClientManager::PushSocketClient(QSOCKETCLIENT hSocketClient)
{
	return m_setHSocketClients.insert(hSocketClient).second;
}
bool QSocketClientManager::RemoveSocketClient(QSOCKETCLIENT hSocketClient)
{
	return m_setHSocketClients.erase(hSocketClient) > 0;
}
bool QSocketClientManager::FindSocketClient(QSOCKETCLIENT hSocketClient)
{
	return m_setHSocketClients.find(hSocketClient) != m_setHSocketClients.end();
}
void QSocketClientManager::ClearSocketClient()
{
	m_setHSocketClients.clear();
	return;
}

bool AcceptSocketClient(QSOCKETCLIENT pSocketClient)
{
	return g_qSocketClientManager.PushSocketClient(pSocketClient);
}
bool ExistsSocketClient(QSOCKETCLIENT pSocketClient)
{
	return pSocketClient != QSOCKETCLIENT() && g_qSocketClientManager.FindSocketClient(pSocketClient);
}
bool CloseSocketClient(QSOCKETCLIENT& pSocketClient)
{
	bool bRmv = false;
	if (pSocketClient != QSOCKETCLIENT() && (bRmv = g_qSocketClientManager.RemoveSocketClient(pSocketClient)))
	{
		bRmv = true;
		CloseSocketClient(pSocketClient.hSocketClient);
	}
	return bRmv;
}
void ClearSocketClient()
{
	g_qSocketClientManager.ClearSocketClient();
}